﻿<Window x:Class="CredentialsManager.Views.DialogView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:vw="clr-namespace:CredentialsManager.Views"
        xmlns:vm="clr-namespace:CredentialsManager.ViewModels" 
        xmlns:wi="clr-namespace:CredentialsManager.Controls.WorkingImage"
        SizeToContent="WidthAndHeight" ResizeMode="NoResize"
        Title="{Binding DisplayName}">
    <Window.Resources>
        <DataTemplate DataType="{x:Type vm:CreateUserViewModel}">
            <vw:CreateUserView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:CreateRoleViewModel}">
            <vw:CreateRoleView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:ApplicationViewModel}">
            <vw:ApplicationView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:ResetPasswordViewModel}">
            <vw:ResetPasswordView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:ChangePasswordViewModel}">
            <vw:ChangePasswordView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:UpdateUserViewModel}">
            <vw:UpdateUserView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:UpdatePasswordQuestionViewModel}">
            <vw:UpdatePasswordQuestionView />
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Grid Panel.ZIndex="2"
                    Style="{StaticResource HideIfNotLoadingStyle}"
                    HorizontalAlignment="Center" 
                    VerticalAlignment="Center">
            <wi:WorkingImage />
        </Grid>
        <DockPanel LastChildFill="True" Panel.ZIndex="1" Style="{StaticResource DisableIfLoadingStyle}">
            <ContentControl Content="{Binding}" DataContext="{Binding}" Focusable="False" />
        </DockPanel>
    </Grid>
</Window>
